/*
 * OpForceMoveMessage.java
 *
 * Created on June 19, 2007, 10:48 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package jhub.text;

import java.text.MessageFormat;
import java.text.ParseException;
import jhub.DCProtocol;

/**
 *
 * @author dbotelho
 */
public class OpForceMoveMessage extends DCRawCommand{
    
    public static OpForceMoveMessage getInstance(String victimNick,String newIp,String reasonMsg) throws ParseException{
        return new OpForceMoveMessage(MessageFormat.format(DCProtocol.FORCEMOVE_FORMAT,victimNick,newIp,reasonMsg));
    }
    
    private String victimNick;
    private String newIp;
    private String reasonMsg;
    
    /** Creates a new instance of KickMessage */
    public OpForceMoveMessage(String command) throws ParseException{
        super(command);
        parse();
    }
    
    private void parse() throws ParseException{
        Object[] o = new MessageFormat(DCProtocol.FORCEMOVE_FORMAT).parse(command.toString());
        this.victimNick = o[0].toString();
        this.newIp = o[1].toString();
        this.reasonMsg = o[2].toString();
    }

    public String getVictimNick() {
        return victimNick;
    }

    public String getNewIp() {
        return newIp;
    }

    public String getReasonMsg() {
        return reasonMsg;
    }
    
}
